adLockOptimistic. This is the most common type of locking employed by database management systems. When this type of locking is set, the data source only locks a record when an Update method is performed on an ADO recordset. Then the data is written, the lock is released. This results in a lot less time spent with locks on the data.
adLockBatchOptimistic. This is used for batch optimistic cursors, typically associated with remote data. This will not be covered in this book.
Options is a constant that determines how the provider should evaluate the Source argument if its something other than a Command object. The following are some of the definitions of these options:
adCmdText. The Source property is a SQL statement.
adCmdTable and adCmdTableDirect. The Source property is a table name.
adCmdStoredProc. The Source property is a stored procedure name.
adCmdUnknown. The Source property is an unknown type. In this case, the driver figures out the type and performs the appropriate action. Of course, this takes longer, so you should avoid this option.
Opening a Forward-Only Recordset
You can use several methods to create a recordset that reads data. Youll see a couple of examples of how to do this in this chapter. Lets look at some code that shows how to open different types of recordsets with different options.
Examples Filename: Recordsets.frm
Private Sub cmdForward_Click() Dim oRS As Recordset Dim strSQL As String